home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-01-24 | 7.4 KB | 248 lines | [TEXT/MPS ] |
- ;
- ; File: MixedMode.a
- ;
- ; Contains: Mixed Mode Manager Interfaces.
- ;
- ; Version: Technology: System 7.5
- ; Package: Universal Interfaces 2.2 in “MPW” on ETO #20
- ;
- ; Copyright: © 1984-1995 by Apple Computer, Inc.
- ; All rights reserved.
- ;
- ; Bugs?: If you find a problem with this file, use the Apple Bug Reporter
- ; stack. Include the file and version information (from above)
- ; in the problem description and send to:
- ; Internet: apple.bugs@applelink.apple.com
- ; AppleLink: APPLE.BUGS
- ;
- ;
-
- IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
- __MIXEDMODE__ SET 1
-
-
- IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
- include 'Types.a'
- ENDIF
- ; include 'ConditionalMacros.a' ;
-
- kRoutineDescriptorVersion EQU 7
-
- ; MixedModeMagic Magic Cookie/Trap number
- _MixedModeMagic EQU $AAFE
-
- ; Calling Conventions
- ; typedef unsigned short CallingConventionType
-
- kPascalStackBased EQU 0
- kCStackBased EQU 1
- kRegisterBased EQU 2
- kD0DispatchedPascalStackBased EQU 8
- kD1DispatchedPascalStackBased EQU 12
- kD0DispatchedCStackBased EQU 9
- kStackDispatchedPascalStackBased EQU 14
- kThinkCStackBased EQU 5
-
- ; ISA Types
- ; typedef SInt8 ISAType
-
- kM68kISA EQU 0
- kPowerPCISA EQU 1
-
- ; RTA Types
- ; typedef SInt8 RTAType
-
- kOld68kRTA EQU (0 << 4)
- kPowerPCRTA EQU (0 << 4)
- kCFM68kRTA EQU (1 << 4)
-
- kRegisterD0 EQU 0
- kRegisterD1 EQU 1
- kRegisterD2 EQU 2
- kRegisterD3 EQU 3
- kRegisterD4 EQU 8
- kRegisterD5 EQU 9
- kRegisterD6 EQU 10
- kRegisterD7 EQU 11
- kRegisterA0 EQU 4
- kRegisterA1 EQU 5
- kRegisterA2 EQU 6
- kRegisterA3 EQU 7
- kRegisterA4 EQU 12
- kRegisterA5 EQU 13
- kRegisterA6 EQU 14
- ; A7 is the same as the PowerPC SP
- kCCRegisterCBit EQU 16
- kCCRegisterVBit EQU 17
- kCCRegisterZBit EQU 18
- kCCRegisterNBit EQU 19
- kCCRegisterXBit EQU 20
-
- ; typedef unsigned short registerSelectorType
- ; SizeCodes we use everywhere
-
- kNoByteCode EQU 0
- kOneByteCode EQU 1
- kTwoByteCode EQU 2
- kFourByteCode EQU 3
-
- ; Mixed Mode Routine Records
- ; typedef unsigned long ProcInfoType
- ; Routine Flag Bits
- ; typedef unsigned short RoutineFlagsType
-
- kProcDescriptorIsAbsolute EQU $00
- kProcDescriptorIsRelative EQU $01
-
- kFragmentIsPrepared EQU $00
- kFragmentNeedsPreparing EQU $02
-
- kUseCurrentISA EQU $00
- kUseNativeISA EQU $04
-
- kPassSelector EQU $0
- kDontPassSelector EQU $08
-
- kRoutineIsNotDispatchedDefaultRoutine EQU $0
- kRoutineIsDispatchedDefaultRoutine EQU $10
-
- RoutineRecord RECORD 0
- procInfo ds.l 1 ; offset: $0 (0) ; calling conventions
- reserved1 ds.b 1 ; offset: $4 (4) ; Must be 0
- ISA ds.b 1 ; offset: $5 (5) ; Instruction Set Architecture
- routineFlags ds.w 1 ; offset: $6 (6) ; Flags for each routine
- procDescriptor ds.l 1 ; offset: $8 (8) ; Where is the thing we’re calling?
- reserved2 ds.l 1 ; offset: $C (12) ; Must be 0
- selector ds.l 1 ; offset: $10 (16) ; For dispatched routines, the selector
- sizeof EQU * ; size: $14 (20)
- ENDR
-
- ; typedef struct RoutineRecord RoutineRecord
- ; typedef RoutineRecord *RoutineRecordPtr, **RoutineRecordHandle
- ; Mixed Mode Routine Descriptors
- ; Definitions of the Routine Descriptor Flag Bits
- ; typedef UInt8 RDFlagsType
-
- kSelectorsAreNotIndexable EQU $00
- kSelectorsAreIndexable EQU $01
-
- ; Routine Descriptor Structure
- RoutineDescriptor RECORD 0
- goMixedModeTrap ds.w 1 ; offset: $0 (0) ; Our A-Trap
- version ds.b 1 ; offset: $2 (2) ; Current Routine Descriptor version
- routineDescriptorFlags ds.b 1 ; offset: $3 (3) ; Routine Descriptor Flags
- reserved1 ds.l 1 ; offset: $4 (4) ; Unused, must be zero
- reserved2 ds.b 1 ; offset: $8 (8) ; Unused, must be zero
- selectorInfo ds.b 1 ; offset: $9 (9) ; If a dispatched routine, calling convention, else 0
- routineCount ds.w 1 ; offset: $A (10) ; Number of routines in this RD
- routineRecords ds RoutineRecord ; offset: $C (12) ; The individual routines
- sizeof EQU * ; size: $20 (32)
- ENDR
-
- ; typedef struct RoutineDescriptor RoutineDescriptor
- ; typedef RoutineDescriptor *RoutineDescriptorPtr, **RoutineDescriptorHandle
-
- ; Calling Convention Offsets
- kCallingConventionWidth EQU 4
- kCallingConventionPhase EQU 0
- kCallingConventionMask EQU $F
- ; Result Offsets
- kResultSizeWidth EQU 2
- kResultSizePhase EQU kCallingConventionWidth
- kResultSizeMask EQU $30
- ; Parameter offsets & widths
- kStackParameterWidth EQU 2
- kStackParameterPhase EQU (kCallingConventionWidth + kResultSizeWidth)
- kStackParameterMask EQU $FFFFFFC0
- ; Register Result Location offsets & widths
- kRegisterResultLocationWidth EQU 5
- kRegisterResultLocationPhase EQU (kCallingConventionWidth + kResultSizeWidth)
- ; Register Parameter offsets & widths
- kRegisterParameterWidth EQU 5
- kRegisterParameterPhase EQU (kCallingConventionWidth + kResultSizeWidth + kRegisterResultLocationWidth)
- kRegisterParameterMask EQU $7FFFF800
- kRegisterParameterSizePhase EQU 0
- kRegisterParameterSizeWidth EQU 2
- kRegisterParameterWhichPhase EQU kRegisterParameterSizeWidth
- kRegisterParameterWhichWidth EQU 3
- ; Dispatched Stack Routine Selector offsets & widths
- kDispatchedSelectorSizeWidth EQU 2
- kDispatchedSelectorSizePhase EQU (kCallingConventionWidth + kResultSizeWidth)
- ; Dispatched Stack Routine Parameter offsets
- kDispatchedParameterPhase EQU (kCallingConventionWidth + kResultSizeWidth + kDispatchedSelectorSizeWidth)
- ; Special Case offsets & widths
- kSpecialCaseSelectorWidth EQU 6
- kSpecialCaseSelectorPhase EQU kCallingConventionWidth
- kSpecialCaseSelectorMask EQU $3F0
- ; Component Manager Special Case offsets & widths
- kComponentMgrResultSizeWidth EQU 2
- kComponentMgrResultSizePhase EQU kCallingConventionWidth + kSpecialCaseSelectorWidth ; 4 + 6 = 10
- kComponentMgrParameterWidth EQU 2
- kComponentMgrParameterPhase EQU kComponentMgrResultSizePhase + kComponentMgrResultSizeWidth ; 10 + 2 = 12
-
- kSpecialCase EQU $0000000F
-
- ; all of the special cases enumerated. The selector field is 6 bits wide
- kSpecialCaseHighHook EQU 0
- kSpecialCaseCaretHook EQU 0 ; same as kSpecialCaseHighHook
- kSpecialCaseEOLHook EQU 1
- kSpecialCaseWidthHook EQU 2
- kSpecialCaseTextWidthHook EQU 2 ; same as kSpecialCaseWidthHook
- kSpecialCaseNWidthHook EQU 3
- kSpecialCaseDrawHook EQU 4
- kSpecialCaseHitTestHook EQU 5
- kSpecialCaseTEFindWord EQU 6
- kSpecialCaseProtocolHandler EQU 7
- kSpecialCaseSocketListener EQU 8
- kSpecialCaseTERecalc EQU 9
- kSpecialCaseTEDoText EQU 10
- kSpecialCaseGNEFilterProc EQU 11
- kSpecialCaseMBarHook EQU 12
- kSpecialCaseComponentMgr EQU 13
-
- IF GENERATINGCFM THEN
- ;
- ; pascal UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _NewRoutineDescriptor
- moveq #0,d0
- dc.w $AA59
- EndM
- ELSE
- IMPORT_CFM_FUNCTION NewRoutineDescriptor
- ENDIF
-
- ;
- ; pascal void DisposeRoutineDescriptor(UniversalProcPtr theProcPtr)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _DisposeRoutineDescriptor
- moveq #1,d0
- dc.w $AA59
- EndM
- ELSE
- IMPORT_CFM_FUNCTION DisposeRoutineDescriptor
- ENDIF
-
- ;
- ; pascal UniversalProcPtr NewFatRoutineDescriptor(ProcPtr theM68kProc, ProcPtr thePowerPCProc, ProcInfoType theProcInfo)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _NewFatRoutineDescriptor
- moveq #2,d0
- dc.w $AA59
- EndM
- ELSE
- IMPORT_CFM_FUNCTION NewFatRoutineDescriptor
- ENDIF
-
- ELSE
- ENDIF
- IF CFMSYSTEMCALLS THEN
- ENDIF
- ENDIF ; __MIXEDMODE__
-